package  
{
	import flash.display.*;
	import flash.events.*;
	import iks.utils.geom.*;
	import vehicle.*;
	
	public final class PursueTest extends Sprite 
	{
		
		public function PursueTest() 
		{
			this.stage.align = StageAlign.TOP_LEFT;
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			
			m_seeker = new SteeredVehicle();
			m_seeker.x = 400;
			this.addChild(m_seeker);
			
			m_pursuer = new SteeredVehicle();
			m_pursuer.x = 400;
			this.addChild(m_pursuer);
			
			m_target = new Vehicle();
			m_target.position = new Vector2D(200, 300);
			m_target.velocity.length = 15;
			this.addChild(m_target);
			
			this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
		}
		
		private function onEnterFrameHandler(evt : Event) : void
		{
			m_seeker.seek(new Vector2D(m_target.x, m_target.y));
			m_seeker.update();
			
			m_pursuer.pursue(m_target);
			m_pursuer.update();
			
			m_target.update();
		}
		
		private var m_seeker	: SteeredVehicle = null;
		private var m_pursuer	: SteeredVehicle = null;
		private var m_target	: Vehicle = null;
	}

}

































///////////////////////////////////////////////////////////////////////////////////////////////////
// end file